

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

import java.util.Iterator;

public class Exercise1 {
    public static void main(String[] args) {
        List list = new ArrayList();
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 10; i++) {
            list.add(sc.nextInt());
        }
        System.out.println("原来的数据 ");
        System.out.println("******************");
        Iterator i = list.iterator();
        while(i.hasNext()) {
            System.out.println(i.next());
        }
        System.out.println("******************");
        Collections.reverse(list);
        System.out.println("倒序后：");
        Iterator i1 = list.iterator();
        while(i1.hasNext()) {
            System.out.println(i1.next());
        }
        System.out.println("******************");
        System.out.println("排序后：");

        Comparator com = new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                if(o1 instanceof Integer && o2 instanceof Integer) {
                    Integer g1 = (Integer) o1;
                    Integer g2 = (Integer) o2;

                    return -g1.compareTo(g2);
                }
                throw new RuntimeException("类型不匹配");
            }

        };
        Collections.sort(list,com);
        Iterator i2 = list.iterator();
        while(i2.hasNext()) {
            System.out.println(i2.next());
        }
    }
}
